﻿<{include file="header.htm"}>
<link href="<{$config.weburl}>/templates/default/css/booking.css" rel="stylesheet" media="screen" type="text/css" />
<script src="<{$config.weburl}>/templates/default/js/layer/layer.min.js"></script>
<script language="javascript" type="text/javascript" src="<{$config.weburl}>/templates/default/js/jquery.validate.js"></script>
        <div class="width_1210">
            <div class="top_first"> </div>
            <!--订单页面-->
            <div class="order_con" >
                <form id="order_form" action="<{$config.weburl}>/?m=product&s=shop_order_seat" method="post" onsubmit=" return check_data();">
                    <input type="hidden" name="act" value="order"/>
                    <div class="order_left">
                        <div class="order_data_con">
                            <div class="liuc"><img class="fl" src="<{$config.weburl}>/templates/default/images/liucheng.gif"/></div>
                            <div class="yd_msg">
                                <h3>收货信息<span></span></h3>
                                <div class="msg_con">
                                    <dl>
                                        <dt>收货人：</dt>
                                        <dd><input type="text" name="ship_name" id="ship_name" class="msg_text" value="<{$consignee.name}>" /><span>（*此处可输入收件人姓名)</span></dd>
                                    </dl>
                                    <dl>
                                        <dt>联系手机：</dt>
                                        <dd><input type="text" class="msg_text" name="ship_mobile" id="ship_mobile" value="<{$consignee.mobile}>" /></dd>
                                    </dl>

                                    <dl>
                                        <dt>省市区：</dt>
                                        <dd>
                                            <select name="provinceid" id="provinceid"  class="msg_text" style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <{foreach item=vo from=$prov}>
                                                <option value="<{$vo.id}>" <{if $vo.id == $consignee.provinceid}> selected <{/if}> ><{$vo.name}></option>
                                                <{/foreach}>
                                            </select>

                                            <select name="cityid" id="cityid"  class="msg_text"  style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <{if  !empty($consignee.cityid)}>
                                                <option value="<{$consignee.cityid}>" selected><{$consignee.cityid|get_city_name}></option>
                                                <{/if}>
                                            </select>

                                            <select name="areaid" id="areaid"  class="msg_text">
                                                <option value="">请选择</option>
                                                <{if  !empty($consignee.areaid)}>
                                                <option value="<{$consignee.areaid}>" selected><{$consignee.areaid|get_city_name}></option>
                                                <{/if}>
                                            </select>
                                        </dd>
                                    </dl>

                                    <dl>
                                        <dt>街道地址：</dt>
                                        <dd><textarea class="msg_area" name="ship_addr" id="ship_addr" cols="" rows=""><{$consignee.address}></textarea><span>（*此处可输入收件地址或备注信息等)</span></dd>
                                    </dl>
                                </div>
                            </div>

                            <!--电子票信息-->
                            <{if $parent_product.is_electronic_ticket == 1}>
                            <div class="yd_msg">
                                <h3>电子票信息<span></span></h3>
                                <div class="msg_con">
                                    <dl>
                                        <dt>身份证：</dt>
                                        <dd><input type="text" name="id_card" id="id_card" class="msg_text" value="" /></dd>
                                    </dl>
                                    <dl>
                                        <dt>学生证：</dt>
                                        <dd><input type="text" class="msg_text" name="student_card" id="student_card" value="" /></dd>
                                    </dl>

                                </div>
                            </div>
                            <{/if}>
                            <div class="yd_msg">
                                <h3>发票信息<span></span></h3>
                                <div class="msg_con">
                                    <dl>
                                        <dt>类型</dt>
                                        <dd>
                                        <input type="radio" name="invoice_type" id="invoice_person" value="1" style="margin-top: 5px;" />个人
                                         <input type="radio" name="invoice_type" id="invoice_company" value="2" style="margin-top: 5px;"/>企业
                                        </dd>
                                    </dl>
                                    <dl style="display: none;" id="invoice_head">
                                        <dt>发票抬头</dt>
                                        <dd><input type="text" class="msg_text"  name="invoice_company" value="" /></dd>
                                    </dl>
                                
                                </div>
                            </div>

                            <!--是否配送方式-->
                            <div class="zhifu_fs order3">
                                <h3>配送方式</h3>
                                <ul>
                                    <li class="h1">
                                        <div class="i1"><img src="<{$config.weburl}>/templates/default/images/kdps.jpg" /></div>
                                        <div class="i1"><img src="<{$config.weburl}>/templates/default/images/smqp.jpg" /></div>
                                    </li>
                                    <li class="h2">
                                        <div class="i1"><input type="radio" name="delivery_way" checked="checked" value="express"/></div>
                                        <div class="i1"><input type="radio" name="delivery_way"  value="pickup"/></div>
                                    </li>
                                </ul>
                            </div>
                            <!--支付方式-->
                            <div class="zhifu_fs">
                                <h3>支付方式</h3>
                                <div class="fs_con">
                                    <dl>
                                        <dt>在线支付方式</dt>
                                        <dd>
                                            <ul>
                                                <li>
                                                <label>
                                                    <em><img class="fl" src="<{$config.weburl}>/templates/default/images/zfb_ico.gif" alt="支付宝" /></em>
                                                    <span>即时到账</span>
                                                    <input type="radio" name="pay_type" checked value="alipay">
                                                </label>
                                            </li>
                                                <!--<li>-->
                                                <!--<label>-->
                                                    <!--<em><img class="fl" src="<{$config.weburl}>/templates/default/images/tenpay.gif" alt="财付通" width="120px" /></em>-->
                                                    <!--<span>财付通</span>-->
                                                    <!--<input type="radio" name="pay_type" value="tenpay">-->
                                                <!--</label>-->
                                            <!--</li>-->
                                                <li>
                                                <label>
                                                    <em><img class="fl" src="<{$config.weburl}>/templates/default/images/cbp.gif" alt="网银在线" width="120px" /></em>
                                                    <span>网银在线</span>
                                                    <input type="radio" name="pay_type" value="cbp" data-type="网银在线">
                                                </label>
                                                </li>

                                                <!--<li>-->
                                                    <!--<label>-->
                                                        <!--<em><img class="fl" src="<{$config.weburl}>/templates/default/images/zfb_ico.gif" alt="货到付款" width="120px" /></em>-->
                                                        <!--<span>货到付款</span>-->
                                                        <!--<input type="radio" name="pay_type" value="cod" data-type="货到付款">-->
                                                    <!--</label>-->
                                                <!--</li>-->

                                            </ul></dd></dl>
                                </div>
                            </div>
                            <!--支付方式end-->


                            <div class="cp_num_con">
                                <dl>
                                    <dt>
                                        <span>名称</span>
                                    <span>日期</span>
                                    <span>单价</span>
                                    <span>购买数量</span>
                                    <span>金额</span>
                                    </dt>
                                    <dd>

                                        <ul>
                                            <li><{$product_info.pname|truncate:20:'...'}></li>
                                            <li><{$product_info.performance_start_time|date_format:"%Y-%m-%d"}></li>
                                            <li><{$product_info.price}></li>
                                            <li>
                                                <input type="hidden" name="product_id" value="<{$product_info.id}>"/>

                                                <input type="text" class="gm_num" name="num"  value="<{$product_info.num}>" data-price="<{$product_info.price}>" data-stock="<{$product_info.stock}>" readonly />

                                            </li>
                                            <li>&yen;<span class="singleprice"><{$product_info.price}></span></li>
                                        </ul>

                                    </dd>
                                </dl>
                            </div>

                            <!--订单金额-->
                            <div class="order_money">
                                <!--<p><em>验证码：<input class="cd-txt" name="checkcode" value="" id="yzm_code" type="text"/><img  class="wd_yzm" src="<{$config.weburl}>/includes/rand_func.php?rand=<{$now_time}>" width="80" height="30"  onclick="this.src = '<{$config.weburl}>/includes/rand_func.php?rand=' + Math.random()" /></em></p>-->
                                <p><em>座位:</em>
                                    <{foreach item=vo from=$ticket_info.body.ticket}>
                                        <{$vo.seat}> &nbsp;
                                    <{/foreach}>
                                </p>
                                <{if $points > 0}>
                                <p><em>积分抵扣: <input type="checkbox" name="cost_point" value="<{$points}>" /> <{$points}> 元</p>
                               <{/if}>
                                <p><em>订单金额：&yen;<span class="totalprice" id="totalprice"><{$total_price}></span>元</em></p>
                            </div>
                            <!--预定按钮-->
                            <div class="tj_btn_order">
                                <input type="hidden" name="spot_id" value="<{$product_info.spot}>" />
                                <a href="javascript:;" class="btnsaveorder">提交订单</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <script type="text/javascript">

            function get_total_price(){
                var total_price = parseFloat(0);
                $(".cp_num_con").find('.gm_num').each(function(i){
                    num = $(this).val();
                    price = $(this).attr('data-price');
                    sing_price = parseInt(num)*parseFloat(price);
                    $(this).parent().next().find(".singleprice").html(sing_price.toFixed(2));
                    total_price = total_price + sing_price;
                });
                $("#totalprice").html(total_price.toFixed(2));
            }

            $("#provinceid").on('change',function(){
                var provinceid = $(this).val();
                $.post("<{$config.weburl}>/ajax.php",{action:'get_city',id:provinceid},function(ret){
                     ret = eval('('+ret+')');
                     $("#cityid").html(ret.content);
                });
            });
            $("#cityid").on('change',function(){
                var cityid = $(this).val();
                $.post("<{$config.weburl}>/ajax.php",{action:'get_city',id:cityid},function(ret){
                     ret = eval('('+ret+')');
                     $("#areaid").html(ret.content);
                });
            });
            $("#invoice_person").on('click',function(){
                $("#invoice_head").hide();
            });
            $("#invoice_company").on('click',function(){
                $("#invoice_head").show();
             });
         //增加数量
            $(".up").on('click',function(){
                stock = $(this).prev().attr('data-stock');
                value = $(this).prev().val();
                up_value = parseInt(value) + 1;
                if(up_value <= stock ){
                    $(this).prev().val(up_value)
                    get_total_price();
                } else {
                    alert("库存不足");
                }

            });

            //减少数量
            $(".down").on('click',function(){
                value = $(this).next().val();
                up_value = parseInt(value) - 1;
                if(value != 1){
                    $(this).next().val(up_value)
                    get_total_price();
                }
            });

            $(".btnsaveorder").on('click',function(){
                $("#order_form").submit();
            });

//            $("#yzm_code").blur(function(){
//                var yzm_code =  $("#yzm_code").val();
//                $.get("<{$config.weburl}>/ajax_back_end.php",{yzm:yzm_code},function(ret){
//                    if(ret === 'false'){
//                        alert("验证码错误");
//                    }
//                });
//            });


            function check_data(){
                var ship_name = $("#ship_name").val();
                var ship_mobile = $("#ship_mobile").val();
                var provinceid = $("#provinceid").val();
                var cityid = $("#cityid").val();
                var areaid = $("#areaid").val();
                var ship_addr = $("#ship_addr").val();
                var yzm_code =  $("#yzm_code").val();
                if(ship_name == ''){
                    alert("请填写收货人信息");
                    return false;
                } else if(ship_mobile == '') {
                    alert("请填写联系手机");
                    return false;
                } else if(provinceid == '') {
                    alert("请选择省");
                    return false;
                } else if(cityid == '') {
                    alert("请选择市");
                    return false;
                } else if(areaid == '') {
                    alert("请选择区");
                    return false;
                } else if(ship_addr == '') {
                    alert("请填写街道地址");
                    return false;
                } else {
                    return true;
                }

            }
        </script>
<{include file="footer.htm"}>

